<template>
  <div class="list">
      <detailHead :title='title'></detailHead>
        <div v-if="arr.length > 0" class="none_wrap">
            <div class="list_item" v-for="(item,index) in arr " :key="index">
            <div class="title">
                <span class="blue"></span>
                <h4>{{item.name}}</h4>
            </div>
                <div class="content" @click="heandClick(item)">
                    <div class="item" >
                        <span class="item_t">性别</span>
                        <span class="item_c">{{item.sex}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">出生日期</span>
                        <span class="item_c">{{item.birthday}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">原工作单位</span>
                        <span class="item_c">{{item.work_or_school}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">单位地址</span>
                        <span class="item_c">{{item.address}}</span>
                    </div>
                    <div class="item">
                        <span class="item_t">存放单位</span>
                        <span class="item_c">{{item.save_unit}}</span>
                    </div>
                </div>
        </div>
      </div>
      <div v-else class="none">
          <img src="@/assets/not-found.png" alt="">
          <span>抱歉，暂无搜索结果</span>
      </div>
        <div class="foot1">本服务由咸宁市人社局提供</div>
  </div>
</template>

<script>
import detailHead from "@/components/detailHead.vue";
import axios from 'axios'

export default {
    components: {
        detailHead,
    },
    data(){
        return{
            arr:[],
            title:'社会流动人员档案查询'
            // search_val:''
        }
    },
    mounted(){
        // this.search_val = this.$route.query.val
        this.getList(this.$route.query.searchKey)
    },
    methods:{
        async getList(val){
            // {data:{data}}
            const {data:{data}} = await axios.get(
                'https://ehb-app.xngxq.cn/background/population/query',
                {
                    params:{
                        name:val
                    }
                }
            )
            this.arr = data.list
            console.log(333,data)
        }
    }
}
</script>

<style lang='less' scoped>
//字体颜色 正文 333  弱一点 999
.list{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    .foot1{
        color: #999999;
        font-size: 14px;
        text-align: center;
        position: fixed;
        bottom: 20px;
    }
.none_wrap{
    width: 375px;
    box-sizing: border-box;
    margin-left: 20px;
    .list_item{
        width: 90%;
        border-bottom: 1px solid #eee;
        margin-bottom: 10px;
        .title{
            display: flex;
            align-items: center;
            .blue{
                width: 5px;
                height: 20px;
                background-color: rgb(94, 188, 243);
                margin-right: 4px;
            }
            h4{
                color: rgb(83, 84, 85);
            }
        }
        .content{
            margin-left: 10px;
            margin-top: -5px;
            margin-bottom: 10px;
            color: rgb(129, 127, 127);
            padding-top: 10px;
            width: 100%;
            .item{
                width: 100%;
                display: flex;
                margin-top: 3px;
                .item_t{
                    font-size: 15px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #999999;
                    width: 110px;
                }
                .item_c{
                    font-size: 15px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: #999999;
                    width: 260px;
                }
            }
        }
    }
}
}
.none{
    width: 70%;
    height: 70%;
    margin-top: 50%;
    color: #999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    span{
        color: #999;
        margin-top: 15px;
        font-size: 14px;
    }
}
</style>